import uuid
from sqlalchemy import Column, Integer, String, TIMESTAMP, SmallInteger, ForeignKey
from base import Base  # 导入共享的 Base



class RedBookUser(Base):
    __tablename__ = 'red_book_users'
    uuid = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()), index=True, comment="唯一标识符")
    name = Column(String(255), nullable=False, comment="用户名")
    real_name = Column(String(255), comment="真实姓名")
    id_card = Column(String(66), comment="身份证号")
    wechat_open_id = Column(String(66, 'utf8mb4_unicode_ci'), comment='wechat_open_id')
    wechat_union_id = Column(String(66, 'utf8mb4_unicode_ci'), comment='wechat_union_id')
    avatar_url = Column(String(255, 'utf8mb4_unicode_ci'), comment='头像')
    password = Column(String(255), nullable=False, comment="密码")
    status = Column(SmallInteger, index=True, default=1, comment="状态：0 禁用 1 正常 2 使用 3 到期")
    created_at = Column(TIMESTAMP, nullable=False, comment='创建时间')
    updated_at = Column(TIMESTAMP, nullable=False, comment='更新时间')
    deleted_at = Column(TIMESTAMP, comment='删除时间')
